package com.springinaction.ch03.condition;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.junit.Assert.*;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = MagicConfig.class)
public class MagicExistsConditionTest {

    @BeforeClass
    public static void init(){
       System.setProperty("magic", String.valueOf(true));
    }

    @Autowired
    private MagicBean magic;

   // @Autowired
    //private ApplicationContext context;

    @Test
    public void ConditionTest(){
        assertNotNull(magic);
       // assertTrue(context.containsBean("magicBean"));
    }

}
